

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layuiAdmin 网站用户 iframe 框</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/admin/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>


  <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
	<div class="layui-form-item">
      <label class="layui-form-label">新闻标题</label>
      <div class="layui-input-inline">
        <input type="text" name="title" lay-verify="required" placeholder="请输入新闻标题" autocomplete="off" class="layui-input" id="title">
      </div>
    </div>

      <div class="layui-form-item">
          <label class="layui-form-label">新闻图片200*200</label>
          <div class="layui-input-inline">
              <input type="text" name="img" id="img"  placeholder="请上传图片" autocomplete="off" class="layui-input" >
              <img  id="imgx1" style="width:100px;">
          </div>
          <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传图片</button>
      </div>

      <div class="layui-form-item">
          <label class="layui-form-label">浏览量</label>
          <div class="layui-input-inline">
              <input type="text" name="pv" id="pv"  placeholder="浏览量" autocomplete="off" class="layui-input">
          </div>
      </div>

	    <input type="hidden" name="id" id="id"/>

		<div class="layui-form-item">
            <label class="layui-form-label">新闻内容</label>
            <div class="layui-input-block">
                <textarea id="texter" lay-verify="required" name="texter"></textarea>
                <textarea id="texter2" name="texter2" style="display: none;"></textarea>
			</div>
        </div>


      <div class="layui-form-item" lay-filter="status">
          <label class="layui-form-label">是否推荐到首页</label>
          <div class="layui-input-block">
              <input type="radio" name="istui" checked  id="istui" value="1" title="推荐">
              <input type="radio" name="istui"  id="istui" value="0" title="不推荐">
          </div>
      </div>

      <div class="layui-form-item" lay-filter="status">
          <label class="layui-form-label">状态</label>
          <div class="layui-input-block">
              <input type="radio" name="status" checked  id="status" value="1" title="上线">
              <input type="radio" name="status"  id="status" value="2" title="下线">
          </div>
      </div>



    <div class="layui-form-item layui-hide">
      <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
  </div>

  <script src="/admin/layuiadmin/layui/layui.js"></script>
  <script>
  layui.config({
    base: '/admin/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'upload','tinymce'], function(){
    var $ = layui.$
    ,form = layui.form
    ,upload = layui.upload
	,t = layui.tinymce;

      upload.render({
          elem: '#layuiadmin-upload-useradmin' //绑定元素
          ,url: "{:url('admin/Index/upload')}" //上传接口
          ,ext: 'jpg|png|gif'//限制文件
          ,done: function(res){
              //上传完毕回调
              $(this.item).prev("div").children("input").val(res.filename);
              $("#imgx1").attr('src', res.img);
              // document.getElementById('img').value = res.filename;
              layer.msg("上传成功");
          }
          ,error: function(){
              //请求异常回调
          }
      });

      var edit = t.render({
            elem: "#texter"
            , height: 200
			      ,images_upload_url:'/admin/Index/upload'
            ,convert_urls:false,//取消自动转换url
            // ...
            // 其余配置可参考官方文档
        },function(opt,edit){
            //加载完成后回调
            //编辑器的内容改变时执行 把值赋给textarea
            edit.on('blur', function(){
              $("#texter2").val(edit.getContent());
            });
        });


  })



  </script>
</body>
</html>